export default {
    namespaced: true,
    state: {
        token:  null,
        userInfo: {},
        userName: '',
        userId: null,
        roleType: '',
        userLogo: '',
        isLogin: false,
        userPath:  null,
        chatShow: false,
        community: false,

    },
    mutations: {
        SET_USER_COMMUNITY(state, community) {
            state.community = community
        },
        SET_USER_INFO(state, user) {
            state.userInfo = user;
            state.userName = user.userName;
            state.userId = user.userId;
            state.userLogo = user.userLogo;
            state.roleType = user.roleType;
        },
        SET_TOKEN(state, token) {
            state.token = token;
            setToken(token);
            setLocalToken(token);
        },
        SET_USER_CHAT(state, chatShow) {
            state.chatShow = chatShow;
        },
        SET_USER_PATH(state, userPath) {
            state.userPath = userPath;
        },
        SET_IS_LOGIN(state, isLogin) {
            state.isLogin = isLogin;
        },
        SET_ROLE_TYPE(state, roleType) {
            state.roleType = roleType;
        },
        USER_LOGIC(state) {//用户退出登录
            state.isLogin = false;
            state.userInfo = {};
            state.userId = null;
            state.userLogo = '';
            state.roleType = '';
            state.token = null;
        },
    },
    actions: {
        //todo 登录、获取用户详情
        getUserInfo() {
        }
    },
}